package com.xxxx;

import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.operators.DataSource;

public class Hello02FlinkOperatorMap {

    public static void main(String[] args) throws Exception {

        //获取执行环境
        ExecutionEnvironment environment = ExecutionEnvironment.getExecutionEnvironment();
        //获取数据源
        DataSource<String> source = environment.readTextFile("data/dataset.txt");
        //开始进行转换
        //source.map(new MapFunction<String, String>() {
        //    @Override
        //    public String map(String s) throws Exception {
        //        return s.toUpperCase();
        //    }
        //}).print();
        //开始进行转换
        source.map(line -> line.toUpperCase()).map((String line) -> {
            return line.substring(0, 5);
        }).print();

    }


}
